package com.lagou.service.impl;

import com.lagou.dao.ResumeDao;
import com.lagou.pojo.Resume;
import com.lagou.service.IResumeService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;
import java.util.Optional;

/**
 * @author czq
 * @date 2020/7/15 21:41
 */
@Service
@Transactional
public class ResumeServiceImpl implements IResumeService {

    @Autowired
    private ResumeDao resumeDao;

    @Override
    public List<Resume> findAll() {
        return resumeDao.findAll();
    }

    @Override
    public Resume findById(Long id) {
        Optional<Resume> optional = resumeDao.findById(id);
        return optional.get();
    }

    @Override
    public void addAndUpdate(Resume resume) {
        resumeDao.save(resume);
    }

    @Override
    public void deleteUser(Long id) {
        resumeDao.deleteById(id);
    }
}
